package com.zerowidth.db.bean;

import com.zerowidth.db.utils.TimeUtils;

public class AuthTokenBean {

    public int id;
    public String user_id;
    public String phone_number;
    public String wx_unionid;
    public String qq_openid;
    public String auth_token;
    public String create_time;
    public String valid_date;//有效期截止时间


    public boolean isValid() {
        long createTimeL = TimeUtils.convert(create_time, TimeUtils.TIME_FORMAT_YYYY_MM_DD_HH_MM_SS);

        if (valid_date == null || valid_date.length() == 0) {
            //永久有效
            return true;
        }

        long validDateL = TimeUtils.convert(valid_date, TimeUtils.TIME_FORMAT_YYYY_MM_DD_HH_MM_SS);
        if (System.currentTimeMillis() <= validDateL) {
            return true;
        }
        return false;
    }

}
